<?php


namespace Modules\System\Http\Controllers\Web;


use App\Http\Controllers\MyController;

class DiyPageWebController extends MyController
{

    public function show()
    {
        $path = request()->path();

        if (strstr($path, "/") !== false) {
            [$path] = explode("/", $path);
        }

        $diyPage = app('system')->diyPage($path);

        if ($diyPage) {

            is_diy_page($diyPage);
            return $this->theme($diyPage->page_template ?: 'diy-page', compact('diyPage'));
        }

        abort(404);
    }

}
